package com.ruoyi.erp.common.enums;

/**
 * @author qwc
 * @Date 2021/12/30 11:24
 */
public enum OrderStatus {

    NEW("1", "新建"),

    FINISH("2", "完成"),

    REWORK("3", "返工"),

    CANCEL("4", "取消"),

    REBOOT("5", "重启");

    private final String key;
    private final String value;

    OrderStatus(String key, String value) {
        this.key = key;
        this.value = value;
    }

    public static String getValueByKey(String key) {
        for (OrderStatus orderStatus : OrderStatus.values()) {
            if (orderStatus.getKey().equals(key)) {
                return orderStatus.getValue();
            }
        }
        return null;
    }

    public String getKey() {
        return this.key;
    }

    public String getValue() {
        return this.value;
    }

    public static String getKeyByValue(String value) {
        for (OrderStatus orderStatus : OrderStatus.values()) {
            if (orderStatus.getValue().equals(value)) {
                return orderStatus.getKey();
            }
        }
        return null;
    }
}
